package net.cyue.wj.user.dto;


import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import net.cyue.wj.user.entity.User;
import net.cyue.util.MD5Util;

@Setter
@Getter
public class UserLoginDTO {
    @NotBlank
    public String username;
    @NotBlank
    public String password;

    public User toUser() {
        User u = new User();
        String md5Password = MD5Util.encode(this.password);
        u.setUsername(username);
        u.setPassword(md5Password);
        return u;
    }
}

